package com.mop.calc;
// $ANTLR 3.2 Sep 23, 2009 12:02:23 Calculator.g 2010-05-11 17:50:58

import org.antlr.runtime.*;
import java.util.Stack;
import java.util.List;
import java.util.ArrayList;

public class CalculatorLexer extends Lexer {
    public static final int ENDLP=12;
    public static final int SUB=17;
    public static final int COMP=13;
    public static final int ID=4;
    public static final int EOF=-1;
    public static final int SEMI=6;
    public static final int MUL=16;
    public static final int LPAREN=10;
    public static final int NUM=14;
    public static final int STR=8;
    public static final int RPAREN=11;
    public static final int ECHO=7;
    public static final int WS=19;
    public static final int LOOP=9;
    public static final int EQ=5;
    public static final int DIV=18;
    public static final int ADD=15;

    // delegates
    // delegators

    public CalculatorLexer() {;} 
    public CalculatorLexer(CharStream input) {
        this(input, new RecognizerSharedState());
    }
    public CalculatorLexer(CharStream input, RecognizerSharedState state) {
        super(input,state);

    }
    public String getGrammarFileName() { return "Calculator.g"; }

    // $ANTLR start "STR"
    public final void mSTR() throws RecognitionException {
        try {
            int _type = STR;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:66:5: ( '\\u0022' ( options {greedy=false; } : . )* '\\u0022' )
            // Calculator.g:66:7: '\\u0022' ( options {greedy=false; } : . )* '\\u0022'
            {
            match('\"'); 
            // Calculator.g:66:16: ( options {greedy=false; } : . )*
            loop1:
            do {
                int alt1=2;
                int LA1_0 = input.LA(1);

                if ( (LA1_0=='\"') ) {
                    alt1=2;
                }
                else if ( ((LA1_0>='\u0000' && LA1_0<='!')||(LA1_0>='#' && LA1_0<='\uFFFF')) ) {
                    alt1=1;
                }


                switch (alt1) {
            	case 1 :
            	    // Calculator.g:66:40: .
            	    {
            	    matchAny(); 

            	    }
            	    break;

            	default :
            	    break loop1;
                }
            } while (true);

            match('\"'); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "STR"

    // $ANTLR start "COMP"
    public final void mCOMP() throws RecognitionException {
        try {
            int _type = COMP;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:67:6: ( '>' | '<' | '==' | '<=' | '>=' )
            int alt2=5;
            switch ( input.LA(1) ) {
            case '>':
                {
                int LA2_1 = input.LA(2);

                if ( (LA2_1=='=') ) {
                    alt2=5;
                }
                else {
                    alt2=1;}
                }
                break;
            case '<':
                {
                int LA2_2 = input.LA(2);

                if ( (LA2_2=='=') ) {
                    alt2=4;
                }
                else {
                    alt2=2;}
                }
                break;
            case '=':
                {
                alt2=3;
                }
                break;
            default:
                NoViableAltException nvae =
                    new NoViableAltException("", 2, 0, input);

                throw nvae;
            }

            switch (alt2) {
                case 1 :
                    // Calculator.g:67:8: '>'
                    {
                    match('>'); 

                    }
                    break;
                case 2 :
                    // Calculator.g:67:14: '<'
                    {
                    match('<'); 

                    }
                    break;
                case 3 :
                    // Calculator.g:67:20: '=='
                    {
                    match("=="); 


                    }
                    break;
                case 4 :
                    // Calculator.g:67:27: '<='
                    {
                    match("<="); 


                    }
                    break;
                case 5 :
                    // Calculator.g:67:34: '>='
                    {
                    match(">="); 


                    }
                    break;

            }
            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "COMP"

    // $ANTLR start "LOOP"
    public final void mLOOP() throws RecognitionException {
        try {
            int _type = LOOP;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:68:6: ( 'loop' )
            // Calculator.g:68:8: 'loop'
            {
            match("loop"); 


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "LOOP"

    // $ANTLR start "ENDLP"
    public final void mENDLP() throws RecognitionException {
        try {
            int _type = ENDLP;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:69:7: ( 'end loop' )
            // Calculator.g:69:9: 'end loop'
            {
            match("end loop"); 


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "ENDLP"

    // $ANTLR start "ECHO"
    public final void mECHO() throws RecognitionException {
        try {
            int _type = ECHO;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:70:6: ( 'echo' )
            // Calculator.g:70:8: 'echo'
            {
            match("echo"); 


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "ECHO"

    // $ANTLR start "ID"
    public final void mID() throws RecognitionException {
        try {
            int _type = ID;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:71:4: ( ( 'a' .. 'z' | 'A' .. 'Z' )+ )
            // Calculator.g:71:6: ( 'a' .. 'z' | 'A' .. 'Z' )+
            {
            // Calculator.g:71:6: ( 'a' .. 'z' | 'A' .. 'Z' )+
            int cnt3=0;
            loop3:
            do {
                int alt3=2;
                int LA3_0 = input.LA(1);

                if ( ((LA3_0>='A' && LA3_0<='Z')||(LA3_0>='a' && LA3_0<='z')) ) {
                    alt3=1;
                }


                switch (alt3) {
            	case 1 :
            	    // Calculator.g:
            	    {
            	    if ( (input.LA(1)>='A' && input.LA(1)<='Z')||(input.LA(1)>='a' && input.LA(1)<='z') ) {
            	        input.consume();

            	    }
            	    else {
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        recover(mse);
            	        throw mse;}


            	    }
            	    break;

            	default :
            	    if ( cnt3 >= 1 ) break loop3;
                        EarlyExitException eee =
                            new EarlyExitException(3, input);
                        throw eee;
                }
                cnt3++;
            } while (true);


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "ID"

    // $ANTLR start "NUM"
    public final void mNUM() throws RecognitionException {
        try {
            int _type = NUM;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:72:5: ( ( '0' .. '9' )+ )
            // Calculator.g:72:7: ( '0' .. '9' )+
            {
            // Calculator.g:72:7: ( '0' .. '9' )+
            int cnt4=0;
            loop4:
            do {
                int alt4=2;
                int LA4_0 = input.LA(1);

                if ( ((LA4_0>='0' && LA4_0<='9')) ) {
                    alt4=1;
                }


                switch (alt4) {
            	case 1 :
            	    // Calculator.g:72:8: '0' .. '9'
            	    {
            	    matchRange('0','9'); 

            	    }
            	    break;

            	default :
            	    if ( cnt4 >= 1 ) break loop4;
                        EarlyExitException eee =
                            new EarlyExitException(4, input);
                        throw eee;
                }
                cnt4++;
            } while (true);


            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "NUM"

    // $ANTLR start "SEMI"
    public final void mSEMI() throws RecognitionException {
        try {
            int _type = SEMI;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:73:6: ( ';' )
            // Calculator.g:73:8: ';'
            {
            match(';'); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "SEMI"

    // $ANTLR start "EQ"
    public final void mEQ() throws RecognitionException {
        try {
            int _type = EQ;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:74:4: ( '=' )
            // Calculator.g:74:6: '='
            {
            match('='); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "EQ"

    // $ANTLR start "ADD"
    public final void mADD() throws RecognitionException {
        try {
            int _type = ADD;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:75:5: ( '+' )
            // Calculator.g:75:7: '+'
            {
            match('+'); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "ADD"

    // $ANTLR start "MUL"
    public final void mMUL() throws RecognitionException {
        try {
            int _type = MUL;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:76:5: ( '*' )
            // Calculator.g:76:7: '*'
            {
            match('*'); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "MUL"

    // $ANTLR start "SUB"
    public final void mSUB() throws RecognitionException {
        try {
            int _type = SUB;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:77:5: ( '-' )
            // Calculator.g:77:7: '-'
            {
            match('-'); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "SUB"

    // $ANTLR start "DIV"
    public final void mDIV() throws RecognitionException {
        try {
            int _type = DIV;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:78:5: ( '/' )
            // Calculator.g:78:7: '/'
            {
            match('/'); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "DIV"

    // $ANTLR start "LPAREN"
    public final void mLPAREN() throws RecognitionException {
        try {
            int _type = LPAREN;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:79:8: ( '(' )
            // Calculator.g:79:10: '('
            {
            match('('); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "LPAREN"

    // $ANTLR start "RPAREN"
    public final void mRPAREN() throws RecognitionException {
        try {
            int _type = RPAREN;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:80:8: ( ')' )
            // Calculator.g:80:10: ')'
            {
            match(')'); 

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "RPAREN"

    // $ANTLR start "WS"
    public final void mWS() throws RecognitionException {
        try {
            int _type = WS;
            int _channel = DEFAULT_TOKEN_CHANNEL;
            // Calculator.g:81:4: ( ( ' ' | '\\t' | '\\r' | '\\n' )+ )
            // Calculator.g:81:6: ( ' ' | '\\t' | '\\r' | '\\n' )+
            {
            // Calculator.g:81:6: ( ' ' | '\\t' | '\\r' | '\\n' )+
            int cnt5=0;
            loop5:
            do {
                int alt5=2;
                int LA5_0 = input.LA(1);

                if ( ((LA5_0>='\t' && LA5_0<='\n')||LA5_0=='\r'||LA5_0==' ') ) {
                    alt5=1;
                }


                switch (alt5) {
            	case 1 :
            	    // Calculator.g:
            	    {
            	    if ( (input.LA(1)>='\t' && input.LA(1)<='\n')||input.LA(1)=='\r'||input.LA(1)==' ' ) {
            	        input.consume();

            	    }
            	    else {
            	        MismatchedSetException mse = new MismatchedSetException(null,input);
            	        recover(mse);
            	        throw mse;}


            	    }
            	    break;

            	default :
            	    if ( cnt5 >= 1 ) break loop5;
                        EarlyExitException eee =
                            new EarlyExitException(5, input);
                        throw eee;
                }
                cnt5++;
            } while (true);

            _channel=HIDDEN;

            }

            state.type = _type;
            state.channel = _channel;
        }
        finally {
        }
    }
    // $ANTLR end "WS"

    public void mTokens() throws RecognitionException {
        // Calculator.g:1:8: ( STR | COMP | LOOP | ENDLP | ECHO | ID | NUM | SEMI | EQ | ADD | MUL | SUB | DIV | LPAREN | RPAREN | WS )
        int alt6=16;
        alt6 = dfa6.predict(input);
        switch (alt6) {
            case 1 :
                // Calculator.g:1:10: STR
                {
                mSTR(); 

                }
                break;
            case 2 :
                // Calculator.g:1:14: COMP
                {
                mCOMP(); 

                }
                break;
            case 3 :
                // Calculator.g:1:19: LOOP
                {
                mLOOP(); 

                }
                break;
            case 4 :
                // Calculator.g:1:24: ENDLP
                {
                mENDLP(); 

                }
                break;
            case 5 :
                // Calculator.g:1:30: ECHO
                {
                mECHO(); 

                }
                break;
            case 6 :
                // Calculator.g:1:35: ID
                {
                mID(); 

                }
                break;
            case 7 :
                // Calculator.g:1:38: NUM
                {
                mNUM(); 

                }
                break;
            case 8 :
                // Calculator.g:1:42: SEMI
                {
                mSEMI(); 

                }
                break;
            case 9 :
                // Calculator.g:1:47: EQ
                {
                mEQ(); 

                }
                break;
            case 10 :
                // Calculator.g:1:50: ADD
                {
                mADD(); 

                }
                break;
            case 11 :
                // Calculator.g:1:54: MUL
                {
                mMUL(); 

                }
                break;
            case 12 :
                // Calculator.g:1:58: SUB
                {
                mSUB(); 

                }
                break;
            case 13 :
                // Calculator.g:1:62: DIV
                {
                mDIV(); 

                }
                break;
            case 14 :
                // Calculator.g:1:66: LPAREN
                {
                mLPAREN(); 

                }
                break;
            case 15 :
                // Calculator.g:1:73: RPAREN
                {
                mRPAREN(); 

                }
                break;
            case 16 :
                // Calculator.g:1:80: WS
                {
                mWS(); 

                }
                break;

        }

    }


    protected DFA6 dfa6 = new DFA6(this);
    static final String DFA6_eotS =
        "\3\uffff\1\20\2\6\13\uffff\6\6\1\32\1\uffff\1\33\2\uffff";
    static final String DFA6_eofS =
        "\34\uffff";
    static final String DFA6_minS =
        "\1\11\2\uffff\1\75\1\157\1\143\13\uffff\1\157\1\144\1\150\1\160"+
        "\1\40\1\157\1\101\1\uffff\1\101\2\uffff";
    static final String DFA6_maxS =
        "\1\172\2\uffff\1\75\1\157\1\156\13\uffff\1\157\1\144\1\150\1\160"+
        "\1\40\1\157\1\172\1\uffff\1\172\2\uffff";
    static final String DFA6_acceptS =
        "\1\uffff\1\1\1\2\3\uffff\1\6\1\7\1\10\1\12\1\13\1\14\1\15\1\16"+
        "\1\17\1\20\1\11\7\uffff\1\4\1\uffff\1\3\1\5";
    static final String DFA6_specialS =
        "\34\uffff}>";
    static final String[] DFA6_transitionS = {
            "\2\17\2\uffff\1\17\22\uffff\1\17\1\uffff\1\1\5\uffff\1\15\1"+
            "\16\1\12\1\11\1\uffff\1\13\1\uffff\1\14\12\7\1\uffff\1\10\1"+
            "\2\1\3\1\2\2\uffff\32\6\6\uffff\4\6\1\5\6\6\1\4\16\6",
            "",
            "",
            "\1\2",
            "\1\21",
            "\1\23\12\uffff\1\22",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "",
            "\1\24",
            "\1\25",
            "\1\26",
            "\1\27",
            "\1\30",
            "\1\31",
            "\32\6\6\uffff\32\6",
            "",
            "\32\6\6\uffff\32\6",
            "",
            ""
    };

    static final short[] DFA6_eot = DFA.unpackEncodedString(DFA6_eotS);
    static final short[] DFA6_eof = DFA.unpackEncodedString(DFA6_eofS);
    static final char[] DFA6_min = DFA.unpackEncodedStringToUnsignedChars(DFA6_minS);
    static final char[] DFA6_max = DFA.unpackEncodedStringToUnsignedChars(DFA6_maxS);
    static final short[] DFA6_accept = DFA.unpackEncodedString(DFA6_acceptS);
    static final short[] DFA6_special = DFA.unpackEncodedString(DFA6_specialS);
    static final short[][] DFA6_transition;

    static {
        int numStates = DFA6_transitionS.length;
        DFA6_transition = new short[numStates][];
        for (int i=0; i<numStates; i++) {
            DFA6_transition[i] = DFA.unpackEncodedString(DFA6_transitionS[i]);
        }
    }

    class DFA6 extends DFA {

        public DFA6(BaseRecognizer recognizer) {
            this.recognizer = recognizer;
            this.decisionNumber = 6;
            this.eot = DFA6_eot;
            this.eof = DFA6_eof;
            this.min = DFA6_min;
            this.max = DFA6_max;
            this.accept = DFA6_accept;
            this.special = DFA6_special;
            this.transition = DFA6_transition;
        }
        public String getDescription() {
            return "1:1: Tokens : ( STR | COMP | LOOP | ENDLP | ECHO | ID | NUM | SEMI | EQ | ADD | MUL | SUB | DIV | LPAREN | RPAREN | WS );";
        }
    }
 

}